3.1.4 \(\int \frac {\cos (x)}{i+\cot (x)} \, dx\) [4]

Optimal. Leaf size=19 \[ -\frac {1}{3} \cos ^3(x)-\frac {1}{3} i \sin ^3(x) \]

[Out]

-1/3*cos(x)^3-1/3*I*sin(x)^3

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 19, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 6, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.546, Rules used = {3599, 3187, 3186, 2645, 30, 2644} \begin {gather*} -\frac {1}{3} \cos ^3(x)-\frac {1}{3} i \sin ^3(x) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[x]/(I + Cot[x]),x]

[Out]

-1/3*Cos[x]^3 - (I/3)*Sin[x]^3

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2644

Int[cos[(e_.) + (f_.)*(x_)]^(n_.)*((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(a*f), Subst[Int[
x^m*(1 - x^2/a^2)^((n - 1)/2), x], x, a*Sin[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2] &&
 !(IntegerQ[(m - 1)/2] && LtQ[0, m, n])

Rule 2645

Int[(cos[(e_.) + (f_.)*(x_)]*(a_.))^(m_.)*sin[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> Dist[-(a*f)^(-1), Subst[
Int[x^m*(1 - x^2/a^2)^((n - 1)/2), x], x, a*Cos[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2]
 &&  !(IntegerQ[(m - 1)/2] && GtQ[m, 0] && LeQ[m, n])

Rule 3186

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*sin[(c_.) + (d_.)*(x_)]^(n_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_
.) + (d_.)*(x_)])^(p_.), x_Symbol] :> Int[ExpandTrig[cos[c + d*x]^m*sin[c + d*x]^n*(a*cos[c + d*x] + b*sin[c +
 d*x])^p, x], x] /; FreeQ[{a, b, c, d, m, n}, x] && IGtQ[p, 0]

Rule 3187

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*sin[(c_.) + (d_.)*(x_)]^(n_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_
.) + (d_.)*(x_)])^(p_), x_Symbol] :> Dist[a^p*b^p, Int[(Cos[c + d*x]^m*Sin[c + d*x]^n)/(b*Cos[c + d*x] + a*Sin
[c + d*x])^p, x], x] /; FreeQ[{a, b, c, d, m, n}, x] && EqQ[a^2 + b^2, 0] && ILtQ[p, 0]

Rule 3599

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[Sin[e + f*x]^
m*((a*Cos[e + f*x] + b*Sin[e + f*x])^n/Cos[e + f*x]^n), x] /; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] &&
 ILtQ[n, 0] && ((LtQ[m, 5] && GtQ[n, -4]) || (EqQ[m, 5] && EqQ[n, -1]))

Rubi steps

\begin {align*} \int \frac {\cos (x)}{i+\cot (x)} \, dx &=-\int \frac {\cos (x) \sin (x)}{-\cos (x)-i \sin (x)} \, dx\\ &=i \int \cos (x) (-i \cos (x)-\sin (x)) \sin (x) \, dx\\ &=i \int \left (-i \cos ^2(x) \sin (x)-\cos (x) \sin ^2(x)\right ) \, dx\\ &=-\left (i \int \cos (x) \sin ^2(x) \, dx\right )+\int \cos ^2(x) \sin (x) \, dx\\ &=-\left (i \text {Subst}\left (\int x^2 \, dx,x,\sin (x)\right )\right )-\text {Subst}\left (\int x^2 \, dx,x,\cos (x)\right )\\ &=-\frac {1}{3} \cos ^3(x)-\frac {1}{3} i \sin ^3(x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.02, size = 19, normalized size = 1.00 \begin {gather*} \frac {1}{3} \left (-\cos ^3(x)-i \sin ^3(x)\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[x]/(I + Cot[x]),x]

[Out]

(-Cos[x]^3 - I*Sin[x]^3)/3

________________________________________________________________________________________

Maple [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 48 vs. \(2 (14 ) = 28\).
time = 0.21, size = 49, normalized size = 2.58

method result size
risch \(-\frac {{\mathrm e}^{i x}}{4}-\frac {{\mathrm e}^{-3 i x}}{12}\) \(16\)
default \(\frac {i}{-2 i+2 \tan \left (\frac {x}{2}\right )}-\frac {2 i}{3 \left (-i+\tan \left (\frac {x}{2}\right )\right )^{3}}-\frac {1}{\left (-i+\tan \left (\frac {x}{2}\right )\right )^{2}}-\frac {i}{2 \left (\tan \left (\frac {x}{2}\right )+i\right )}\) \(49\)
norman \(\frac {\frac {2 \left (\tan ^{2}\left (x \right )\right )}{3}+\frac {2 \left (\tan ^{2}\left (\frac {x}{2}\right )\right )}{3}+\frac {2 i \tan \left (x \right )}{3}-\frac {4 i \tan \left (\frac {x}{2}\right )}{3}-\frac {2 \tan \left (x \right ) \tan \left (\frac {x}{2}\right )}{3}-\frac {2 i \tan \left (x \right ) \left (\tan ^{2}\left (\frac {x}{2}\right )\right )}{3}-\frac {2 i \left (\tan ^{2}\left (x \right )\right ) \tan \left (\frac {x}{2}\right )}{3}}{\left (1+\tan ^{2}\left (\frac {x}{2}\right )\right ) \left (1+\tan ^{2}\left (x \right )\right )}\) \(77\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(x)/(I+cot(x)),x,method=_RETURNVERBOSE)

[Out]

1/2*I/(-I+tan(1/2*x))-2/3*I/(-I+tan(1/2*x))^3-1/(-I+tan(1/2*x))^2-1/2*I/(tan(1/2*x)+I)

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/(I+cot(x)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

Fricas [A]
time = 3.94, size = 14, normalized size = 0.74 \begin {gather*} -\frac {1}{12} \, {\left (3 \, e^{\left (4 i \, x\right )} + 1\right )} e^{\left (-3 i \, x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/(I+cot(x)),x, algorithm="fricas")

[Out]

-1/12*(3*e^(4*I*x) + 1)*e^(-3*I*x)

________________________________________________________________________________________

Sympy [A]
time = 0.05, size = 17, normalized size = 0.89 \begin {gather*} - \frac {e^{i x}}{4} - \frac {e^{- 3 i x}}{12} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/(I+cot(x)),x)

[Out]

-exp(I*x)/4 - exp(-3*I*x)/12

________________________________________________________________________________________

Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 31 vs. \(2 (13) = 26\).
time = 0.42, size = 31, normalized size = 1.63 \begin {gather*} -\frac {i}{2 \, {\left (\tan \left (\frac {1}{2} \, x\right ) + i\right )}} - \frac {-3 i \, \tan \left (\frac {1}{2} \, x\right )^{2} + i}{6 \, {\left (\tan \left (\frac {1}{2} \, x\right ) - i\right )}^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/(I+cot(x)),x, algorithm="giac")

[Out]

-1/2*I/(tan(1/2*x) + I) - 1/6*(-3*I*tan(1/2*x)^2 + I)/(tan(1/2*x) - I)^3

________________________________________________________________________________________

Mupad [B]
time = 0.28, size = 40, normalized size = 2.11 \begin {gather*} -\frac {\left (-3\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2+\mathrm {tan}\left (\frac {x}{2}\right )\,2{}\mathrm {i}+1\right )\,2{}\mathrm {i}}{3\,{\left (1+\mathrm {tan}\left (\frac {x}{2}\right )\,1{}\mathrm {i}\right )}^3\,\left (\mathrm {tan}\left (\frac {x}{2}\right )+1{}\mathrm {i}\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(x)/(cot(x) + 1i),x)

[Out]

-((tan(x/2)*2i - 3*tan(x/2)^2 + 1)*2i)/(3*(tan(x/2)*1i + 1)^3*(tan(x/2) + 1i))

________________________________________________________________________________________